// 获取当前日期：年月日
const dateFormat = (date) => {
  var d = new Date(date);
  var year = d.getFullYear();
  var month =
    d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1;
  var day = d.getDate() < 10 ? "0" + d.getDate() : d.getDate();
  return (date = year + "-" + month + "-" + day);
};
// 当前日期年月日时分秒
const timeFormat = (date) => {
  let yy = new Date().getFullYear();
  let dd = new Date().getDate()<10?'0'+new Date().getDate():new Date().getDate()
  let mm =
    new Date().getMonth() + 1 < 10
      ? "0" + (new Date().getMonth() + 1)
      : new Date().getMonth() + 1;
  let hh =
    new Date().getHours() < 10
      ? "0" + new Date().getHours()
      : new Date().getHours();
  let mf =
    new Date().getMinutes() < 10
      ? "0" + new Date().getMinutes()
      : new Date().getMinutes();
  let ss =
    new Date().getSeconds() < 10
      ? "0" + new Date().getSeconds()
      : new Date().getSeconds();
  return (date = yy + "-" + mm + "-" + dd + " " + hh + ":" + mf + ":" + ss);
};
// 当前一个月之后的日期年月日时分秒
const nextMonthDate = (date) => {
  var d = new Date(date);
  var year = d.getFullYear();
  var month =
    d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1;
  var day = d.getDate() < 10 ? "0" + d.getDate() : d.getDate();
  var hh = new Date().getHours();
  var mf =
    new Date().getMinutes() < 10
      ? "0" + new Date().getMinutes()
      : new Date().getMinutes();
  // var ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds();
  return (date = year + "-" + month + "-" + day + " " + hh + ":" + mf);
};

export { dateFormat, timeFormat, nextMonthDate };
